/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Util;

import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.JOptionPane;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.view.JasperViewer;


public class Reporte {
    public static void vistaPantallaEscritorio(InputStream file, List<Map<String, Object>> datos, Map param) {

        try {
//
            JRBeanCollectionDataSource data;
            data = new JRBeanCollectionDataSource(datos);
//
//            Map pars = new HashMap();
//            pars.put("USUARIO", "Ricardo Marcelo");
//            pars.put("LOGO", "/Media/add.gif");

            //Usando el archivo JASPER (compilado)
            JasperReport rep = (JasperReport) JRLoader.loadObject(file);
           
            JasperPrint print = JasperFillManager.fillReport(rep, param, data);

            //Creando y Visualizando PDF
            JasperViewer viewer = new JasperViewer(print, false);
            viewer.setTitle("REPORTES GRÁFICOS  ::::::::  SONRISAS TOOLS V 1.0");
            viewer.setVisible(true);



        } catch (Exception ex) {
            JOptionPane.showMessageDialog(null, ex.getMessage());
            System.out.println(ex.getMessage());
        }



    }
    
}
